tmem: cleanup: drop function tmem_alloc/free_infra
authorBob Liu <lliubbo@gmail.com>
Fri, 8 Nov 2013 01:03:52 +0000 (09:03 +0800)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 12 Nov 2013 15:15:25 +0000 (10:15 -0500)
Useless function can be replaced by xmalloc/xfree directly.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/common/tmem.c
xen/include/xen/tmem_xen.h

index 3d8e67f73e532abfd2ffb788a1242181d5d95b7e..589a515c3b6133e1941d90004b33bd72e7cadd9f 100644 (file)
@@ -1041,7 +1041,7 @@ static struct tmem_pool * pool_alloc(void)
     struct tmem_pool *pool;
     int i;
 
-    if ( (pool = tmem_alloc_infra(sizeof(struct tmem_pool),__alignof__(struct tmem_pool))) == NULL )
+    if ( (pool = xmalloc(struct tmem_pool)) == NULL )
         return NULL;
     for (i = 0; i < OBJ_HASH_BUCKETS; i++)
         pool->obj_rb_root[i] = RB_ROOT;
@@ -1070,7 +1070,7 @@ static NOINLINE void pool_free(struct tmem_pool *pool)
     INVERT_SENTINEL(pool,POOL);
     pool->client = NULL;
     list_del(&pool->pool_list);
-    tmem_free_infra(pool);
+    xfree(pool);
 }
 
 /* register new_client as a user of this shared pool and return new
@@ -1189,7 +1189,7 @@ static void pool_flush(struct tmem_pool *pool, domid_t cli_id, bool_t destroy)
 
 static struct client *client_create(domid_t cli_id)
 {
-    struct client *client = tmem_alloc_infra(sizeof(struct client),__alignof__(struct client));
+    struct client *client = xzalloc(struct client);
     int i;
 
     tmem_client_info("tmem: initializing tmem capability for %s=%d...",
@@ -1199,7 +1199,6 @@ static struct client *client_create(domid_t cli_id)
         tmem_client_err("failed... out of memory\n");
         goto fail;
     }
-    memset(client,0,sizeof(struct client));
     if ( (client->tmem = tmem_client_init(cli_id)) == NULL )
     {
         tmem_client_err("failed... can't allocate host-dependent part of client\n");
@@ -1229,7 +1228,7 @@ static struct client *client_create(domid_t cli_id)
     return client;
 
  fail:
-    tmem_free_infra(client);
+    xfree(client);
     return NULL;
 }
 
@@ -1237,7 +1236,7 @@ static void client_free(struct client *client)
 {
     list_del(&client->client_list);
     tmem_client_destroy(client->tmem);
-    tmem_free_infra(client);
+    xfree(client);
 }
 
 /* flush all data from a client and, optionally, free it */
index bbe1eb6857f9696c360e3f1bad3f047f0a8e7457..d4eafafcb100b8daacba7983983f1bd50e1b9a3e 100644 (file)
@@ -245,20 +245,6 @@ static inline unsigned long tmem_free_mb(void)
     return (tmem_page_list_pages + total_free_pages()) >> (20 - PAGE_SHIFT);
 }
 
-/*
- * Memory allocation for "infrastructure" data
- */
-
-static inline void *tmem_alloc_infra(size_t size, size_t align)
-{
-    return _xmalloc(size,align);
-}
-
-static inline void tmem_free_infra(void *p)
-{
-    return xfree(p);
-}
-
 #define tmem_lock_all  opt_tmem_lock
 #define tmem_called_from_tmem(_memflags) (_memflags & MEMF_tmem)